﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FI.Core
{
    /// <summary>
    /// This interface represents an element which can be placed in to an ordered list.
    /// </summary>
    public interface ISortable
    {
        /// <summary>
        /// The order.
        /// </summary>
        int Order { get; }
    }

    /// <summary>
    /// This class wraps a object as a <see cref="ISortable"/> object with default order 0.
    /// </summary>
    /// <typeparam name="T">The type of wrapped instance.</typeparam>
    public class SortableWrapper<T> : ISortable
    {
        /// <summary>
        /// The wrapped instance.
        /// </summary>
        public T Instance { get; private set; }

        /// <summary>
        /// Create a new SortableWrapper.
        /// </summary>
        /// <param name="instance">The internal instance wrapped.</param>
        public SortableWrapper(T instance)
        {
            this.Instance = instance;
        }
        /// <summary>
        /// The order.
        /// </summary>
        public int Order
        {
            get { return 0; }
        }
    }

}
